<%@ page language="java"  pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@ include file="/includes/main.jsp"%>

<h2 class="contentTitle">
				<c:choose>
					<c:when test="${empty tripModel}">
						<hi:text key="编辑页面" parameterLanguageKeys="班次"/>
					</c:when>
					<c:otherwise>
						<hi:text key="新开班次" />
					</c:otherwise>
				</c:choose>	

</h2>
<form action="tripSave.action?navTabId=tripList&callbackType=closeCurrent&ajax=1" method="post" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone)">
<div class="pageContent">
	<div class="pageFormContent" layoutH="97">
		<dl>
			<dt><hi:text key="线路名称" entity="Trip"/>：</dt>
			<dd>
				<c:choose>
					<c:when test="${empty tripModel}">
						<input type="hidden" name="trip.trip_model.id" value="${trip.trip_model.id}"/>
						<input type="text" class="textInput" name="trip.hi_trip_model.trip_name" value="${trip.trip_model.trip_name}"
							autocomplete="off" lookupGroup="trip" lookupName="trip_model" suggestClass="org.hi.tripmodel.model.TripModel" searchFields="trip_name"/>
						<a class="btnLook" href="<hi:url>tripModelLookup.action?lookup=1</hi:url>" lookupGroup="trip" lookupName="trip_model"><hi:text key="查找带回"/></a>	
					</c:when>
					<c:otherwise>
						<input type="hidden" name="trip.trip_model.id" value="${tripModel.id}"/>
						<input type="text" readonly="readonly" class="textInput" name="trip.hi_trip_model.trip_name" value="${tripModel.trip_name}"/>
					</c:otherwise>
				</c:choose>		
					
			</dd>
		</dl>
		<dl>
			<dt><hi:text key="班次编号" entity="Trip"/>：</dt>
			<dd><input type="text" readonly="readonly" name="trip.trip_code" class="textInput " value="${trip.trip_code}" alt="<hi:text key="开班后自动生成"/>"/></dd>
			
		</dl>
		<dl>
			<dt><hi:text key="基础价" entity="Trip"/>：</dt><dd><input type="text" name="trip.price" class="textInput required float" value="${trip.price}" min="0.0" alt="<hi:text key="请输入基础价"/>"/></dd>
		</dl>
		<dl>
			<dt><hi:text key="限额" entity="Trip"/>：</dt><dd><input type="text" name="trip.seats_available" class="textInput required integer" min="0" value="${trip.seats_available}" alt="<hi:text key="请输入限额"/>"/></dd>
		</dl>
		<dl>
			<dt><hi:text key="开班日期" entity="Trip"/>：</dt>
			<dd>
				<input type="text" name="trip.trip_date" class="textInput date required" readonly="readonly"
					value="<fmt:formatDate value='${trip.trip_date}' pattern='yyyy-MM-dd'/>"/>
				<a href="javascript:void(0)" class="inputDateButton"><hi:text key="选择"/></a>
			</dd>
		</dl>
		<dl>
			<dt><hi:text key="班次折扣" entity="Trip"/>：</dt><dd><input type="text" name="trip.discount" class="textInput discount" value="${trip.discount}" alt="<hi:text key="请输入0-1之间小数"/>"/></dd>
		</dl>
		<dl>
			<dt><hi:text key="折扣开始日期" entity="Trip"/>：</dt>
			<dd>
				<input type="text" id="startDate" name="trip.discount_startDate" class="textInput date" readonly="readonly"
					value="<fmt:formatDate value='${trip.discount_startDate}' pattern='yyyy-MM-dd'/>"/>
				<a href="javascript:void(0)" class="inputDateButton"><hi:text key="选择"/></a>
			</dd>
		</dl>
		<dl>
			<dt><hi:text key="折扣结束时间" entity="Trip"/>：</dt>
			<dd>
				<input type="text" name="trip.discount_endDate" class="textInput date required endDate" readonly="readonly"
					value="<fmt:formatDate value='${trip.discount_endDate}' pattern='yyyy-MM-dd'/>"/>
				<a href="javascript:void(0)" class="inputDateButton"><hi:text key="选择"/></a>
			</dd>
		</dl>
				<input type="hidden" name="trip.id" value="${trip.id}"/>
				<input type="hidden" name="trip.trip_model_code.id" value="${trip.trip_model_code.id}"/>
				<input type="hidden" name="trip.creator.id" value="${trip.creator.id}"/>
				<input type="hidden" name="trip.deleted" value="${trip.deleted}"/>
				<input type="hidden" name="trip.version" value="${trip.version}"/>

		<div class="divider"></div>
		
		<div class="tabs">
			<div class="tabsHeader">
				<div class="tabsHeaderContent">
					<ul>
						<li><a href="javascript:void(0)"><span><hi:text key="价格及返佣"/></span></a></li>
						<li><a href="javascript:void(0)"><span><hi:text key="特殊价格"/></span></a></li>
					</ul>
				</div>
			</div>
			<div class="tabsContent" style="height:150px;">
				<div>
					<table class="list nowrap" width="100%" >
						<thead>
							<tr>
								<th type="text" class="" name="name" size="12" maxlength="30"><hi:text key="价格名称" entity="TripPrice"/></th>
								<th type="text" class=" required float" name="individual_commission" size="12"><hi:text key="散客返佣" entity="TripPrice"/></th>
								<th type="text" class=" float" name="group_commission" size="12"><hi:text key="团队返佣" entity="TripPrice"/></th>
								<th type="text" class=" float" name="net_commission" size="12"><hi:text key="网络追加返佣" entity="TripPrice"/></th>
								<th type="text" class=" integer" name="group_number" size="12"><hi:text key="成团标准" entity="TripPrice"/></th>
								<th type="enum" name="to_whom" enumName="commissionTo" size="12"><hi:text key="返佣对象" entity="TripPrice"/></th>
							</tr>
						</thead>
						<tbody>
							
							<tr>
							<input type="hidden" name="trip.tripPrices[0].id" value="${trip.tripPrices[0].id}"/>
							<input type="hidden" name="trip.tripPrices[0].version" value="${trip.tripPrices[0].version}"/>
								<td>
									<input type="text" class="" name="trip.tripPrices[0].name" value="${trip.tripPrices[0].name}" size="12" maxlength="30"/>
								</td>
								<td>
									<input type="text" class=" required float" min="0.0" name="trip.tripPrices[0].individual_commission" value="${trip.tripPrices[0].individual_commission}" size="12" />
								</td>
								<td>
									<input type="text" class=" required float" min="0.0" name="trip.tripPrices[0].group_commission" value="${trip.tripPrices[0].group_commission}" size="12" />
								</td>
								<td>
									<input type="text" class=" required float" min="0.0" name="trip.tripPrices[0].net_commission" value="${trip.tripPrices[0].net_commission}" size="12" />
								</td>
								<td>
									<input type="text" class=" required integer" min="1" name="trip.tripPrices[0].group_number" value="${trip.tripPrices[0].group_number}" size="12" />
								</td>
								<td>
									<hi:select emu="commissionTo" name="trip.tripPrices[0].to_whom" />
								</td>
							</tr>
							
							<tr>
							<input type="hidden" name="trip.tripPrices[1].id" value="${trip.tripPrices[1].id}"/>
							<input type="hidden" name="trip.tripPrices[1].version" value="${trip.tripPrices[1].version}"/>
								<td>
									<input type="text" class="" name="trip.tripPrices[1].name" value="${trip.tripPrices[1].name}" size="12" maxlength="30"/>
								</td>
								<td>
									<input type="text" class=" required float" min="0.0" name="trip.tripPrices[1].individual_commission" value="${trip.tripPrices[1].individual_commission}" size="12" />
								</td>
								<td>
									<input type="text" class=" required float" min="0.0" name="trip.tripPrices[1].group_commission" value="${trip.tripPrices[1].group_commission}" size="12" />
								</td>
								<td>
									<input type="text" class=" required float" min="0.0" name="trip.tripPrices[1].net_commission" value="${trip.tripPrices[1].net_commission}" size="12" />
								</td>
								<td>
									<input type="text" class=" required integer" min="1" name="trip.tripPrices[1].group_number" value="${trip.tripPrices[1].group_number}" size="12" />
								</td>
								<td>
									<hi:select emu="commissionTo" name="trip.tripPrices[1].to_whom" />
								</td>
							</tr>
							
						</tbody>
					</table>
				</div>								
				<div>
					<table class="list nowrap" width="100%" itemDetail="trip.specialPrices">
						<thead>
							<tr>
								<th type="text" class=" required" name="name" size="12" maxlength="30"><hi:text key="名称" entity="SpecialPrice"/></th>
								<th type="text" class=" required float" name="price" size="12"><hi:text key="价格" entity="SpecialPrice"/></th>
								<th type="enum" name="content" enumType="checkbox" enumName="tripService" size="20"><hi:text key="内容包括" entity="SpecialPrice"/></th>
								<th type="del" width="60"><hi:text key="操作"/></th>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="item" items="${trip.specialPrices}"  varStatus="s">
							<tr>
							<input type="hidden" name="trip.specialPrices[${s.index}].id" value="${item.id}"/>
							<input type="hidden" name="trip.specialPrices[${s.index}].version" value="${item.version}"/>
								<td>
									<input type="text" class=" required" name="trip.specialPrices[${s.index}].name" value="${item.name}" size="12" maxlength="30"/>
								</td>
								<td>
									<input type="text" class=" required float" name="trip.specialPrices[${s.index}].price" value="${item.price}" size="12" alt="<hi:text key="请输浮点数"/>"/>
								</td>
								<td>
									<hi:select emu="tripService" name="trip.specialPrices[${s.index}].content" type="checkbox" multiple="true" value="${item.content}"/>
								</td>
								<td><a href="<hi:url>specialPriceRemove.action?ajax=1&specialPrice.id=${item.id}</hi:url>" class="btnDel" title="<hi:text key="确定要删除吗?"/>">删除</a></td>
							</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>								
				
			</div>
			<div class="tabsFooter">
				<div class="tabsFooterContent"></div>
			</div>
		</div>				
	</div>
	<div class="formBar">
		<ul>
			<li><div class="buttonActive"><div class="buttonContent"><button type="submit"><hi:text key="保存"/></button></div></div></li>
			<li><div class="button"><div class="buttonContent"><button class="close" type="button"><hi:text key="关闭"/></button></div></div></li>
		</ul>
	</div>  
</div>
</form>
